karpathy pytorch-made
karpathy/pytorch-made
This code is an implementation of "Masked AutoEncoder for Density Estimation" by Germain et al., 2015. The core idea is that you can turn an auto-encoder into an autoregressive density model just by appropriately masking the connections in the MLP, ordering the input dimensions in some way and making sure that all outputs only depend on inputs earlier in the list. Like other autoregressive models (char-rnn, pixel cnns, etc), evaluating the likelihood is very cheap (a single forward pass), but sampling is linear in the number of dimensions. The authors of the paper also published code here, but it's a bit wordy, sprawling and in Theano. We can then simultaneously train a larger model ensemble (with weight sharing in the one MLP) and average over all of the models at test time.